<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<% String path = request.getContextPath();
	request.setAttribute("path",path);%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/login.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="css/login.css"/>
	</head>
	<body>
		<div id="login">
			<div id="login_title">
				<span id="jdmc">王府井永光酒店</span>
				<a href="index.jsp"><img src="img/fangzi.png" width="31px"/><span>首页</span></a>
			</div>
			<div id="img">
				<img src="img/login001.jpg"/>
				<div id="img_content">
					<form action="/con/addResUser" method="get">
						<table cellpadding="20px">
							<tr>
								<td colspan="2" id="img_content_zc">
									<span>
										注册
									</span>
									<a href="/con/jump9">去登录……</a>
								</td>
							</tr>
							<tr>
								<td class="fistTr">用户名：</td>
								<td class="sTr"><input type="text" name="username"/></td>
							</tr>
							<tr>
								<td class="fistTr">密码：</td>
								<td class="sTr"><input type="password" name="password"/></td>
							</tr>
							<tr>
								<td class="fistTr">昵称：</td>
								<td class="sTr"><input type="text" name="nickname"/></td>
							</tr>
							<tr>
								<td class="fistTr">真实姓名：</td>
								<td class="sTr"><input type="text" name="realname"/></td>
							</tr>
							<tr>
								<td class="fistTr">性别：</td>
								<td class="sTr">
									<input type="radio" name="sex" checked="checked" name="gender"/>男
									<input type="radio" name="sex" name="gender"/>女
								</td>
							</tr>
							<tr>
								<td class="fistTr">email：</td>
								<td class="sTr"><input type="text" name="email"/></td>
							</tr>
							<tr>
								<td class="fistTr">电话号码：</td>
								<td class="sTr"><input type="text" name="tel" /></td>
							</tr>
							<tr>
								<td class="fistTr">头像：</td>
								<td class="sTr"><input type="file" name="imageUrl" onclick="fileUpload()"/></td>
								<input type="hidden" name="imageUrl" id="fileImg"/>
								<img src="" id="myImg"/>
							</tr>
							<tr>
								<td class="fistTr">地址：</td>
								<td class="sTr"><input type="text" name="address" /></td>
							</tr>
							<tr>
								<td colspan="2">
									<input type="submit" value="注册" id="button_zc" />
									<input type="reset" value="清空" id="button_qk" />
								</td>
							</tr>
						</table>
					</form>
				</div>
			</div>
			<div id="login_foot">
				<img src="img/yejiao2.png"/>
			</div>
		</div>
	</body>
<script type="text/javascript">

	/* 上传图片 */
	function fileUpload(){
		var fileObj = $("#kfImgs");
		var fileEle=fileObj[0].files[0];
		var formData = new FormData();
		formData.append("file",fileEle);
		$.ajax({
			type:"post",
			url:"/kfRoom/fileUpload",
			data:formData,
			dataType: "json",
			contentType:false,
			cache:false,
			processData:false,
			success:function (data){
				var url=data.fileName;
				// var imgEle = document.createElement("img");
				// imgEle.src=url;
				// var mydiv = document.getElementById("mydiv");
				// mydiv.appendChild(imgEle);
				document.getElementById("myImg").src=url;
				document.getElementById("fileImg").value=url;
			}
		});
	}
</script>

</html>
